
from fastapi import FastAPI

#uvicorn main:app --reload 终端启动
#终端需要 pip install fastapi、pip install uvicorn
app = FastAPI()

@app.get("/")
async def root():
    return {"message": "Hello World"}


#学习链接：https://fastapi.tiangolo.com/zh/
if __name__ == '__main__':
    import uvicorn
    uvicorn.run(app,host="127.0.0.1",port=8000)
